<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@next"></script>
  <style>
  </style>
</head>
<body>
  <div id="app">
    <h3>Tooltips with Vue 3 Teleport</h3>
    <div>
      <modal-button></modal-button>
    </div>
  </div>

  <script>
    const app = Vue.createApp({
      
    })
    
    app.component('modal-button', {
      setup() {
        const modalOpen = Vue.ref(false)
        return { modalOpen }
      },
      template: `
      <button @click="modalOpen = true">open modal</button>

      <teleport to="body">
        <div v-if="modalOpen">
          <div>I'am modal</div>
          <button @click="modalOpen = false">Close</button>  
        </div>
      </teleport>`
    })

    app.mount('#app')
  </script>
</body>
</html>